package com.msgserver.mbeans;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.msgserver.ejb.services.CompanyServiceLocal;
import com.msgserver.entity.Company;

@ManagedBean
@ViewScoped
public class TestBean {
	
	public TestBean(){
		
	}
	
	@EJB(mappedName="MsgServer_EAR/CompanyService/local-com.msgserver.ejb.services.CompanyServiceLocal")
	private CompanyServiceLocal companyService;
	private List<Company> companies = new ArrayList<Company>();
	private Company selectedCompany;
	@PostConstruct
	void init(){
		companies = companyService.loadAllCompanies();
	}
	public List<Company> getCompanies() {
		return companies;
	}
	public void setCompanies(List<Company> companies) {
		this.companies = companies;
	}
	public Company getSelectedCompany() {
		return selectedCompany;
	}
	public void setSelectedCompany(Company selectedCompany) {
		this.selectedCompany = selectedCompany;
	}
	
	
}
